package test

import (
	"os"

	"github.com/infraboard/mcube/v2/ioc"

	// 导入程序所有的对
	_ "gitlab.com/go-course-project/go17/vblog/apps"
)

// 给单测使用的
func LoadConfig() {
	// 配置单元单元测试的配置, application.toml
	req := ioc.NewLoadConfigRequest()
	req.ConfigFile.Enabled = true
	// 必须配置绝对逻辑, {Workspace}
	workspaceDir := os.Getenv("WORKSPACE_DIR")
	if workspaceDir == "" {
		req.ConfigFile.Path = "etc/application.toml"
	} else {
		req.ConfigFile.Path = workspaceDir + "/etc/application.toml"
	}

	err := ioc.ConfigIocObject(req)
	if err != nil {
		panic(err)
	}
}
